\hypertarget{pwm_8c}{
\section{atmega1281/low/pwm/pwm.c File Reference}
\label{pwm_8c}\index{atmega1281/low/pwm/pwm.c@{atmega1281/low/pwm/pwm.c}}
}
{\ttfamily \#include \char`\"{}pwm.h\char`\"{}}\par
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{pwm_8c_a173370575e519e4b39a40dcbed25b05c}{MASK\_\-FREQ}~0xF8
\item 
\#define \hyperlink{pwm_8c_a1380779eb88f44d3b04f56f34844cd49}{PRESCALER\_\-1}~PWM\_\-FREQUENCY\_\-15K
\item 
\#define \hyperlink{pwm_8c_aea484618f5434fb66fe764a38f440f1b}{PRESCALER\_\-8}~PWM\_\-FREQUENCY\_\-62K
\item 
\#define \hyperlink{pwm_8c_a8ef1c1674bc0e2e5a50b5ef05333acbb}{PRESCALER\_\-64}~PWM\_\-FREQUENCY\_\-250K
\item 
\#define \hyperlink{pwm_8c_a052c8c73dbda6c25f480ace56519a596}{PRESCALER\_\-256}~PWM\_\-FREQUENCY\_\-2M
\item 
\#define \hyperlink{pwm_8c_adf7f1e9c11964c6871486a89e6cce487}{PRESCALER\_\-1024}~PWM\_\-FREQUENCY\_\-16M
\item 
\#define \hyperlink{pwm_8c_a3fca9ad5cde3e6b6b50ad428aa007b2a}{PWM\_\-R}~OCR0A
\item 
\#define \hyperlink{pwm_8c_a522f80b91bede3a41970a0c8bc2af286}{PWM\_\-L}~OCR0B
\item 
\#define \hyperlink{pwm_8c_a28e851ad9a01cfdb26991ccbabd1f06c}{DIR\_\-MOTOR\_\-PORT\_\-R}~PORTG
\item 
\#define \hyperlink{pwm_8c_ae3f22938cba24c4b865d84a741cc21f5}{DIR\_\-MOTOR\_\-PORT\_\-L}~PORTG
\item 
\#define \hyperlink{pwm_8c_a1ade39389d1a5235ed4d0f0f882356d6}{DIR\_\-MOTOR\_\-DDR\_\-R}~DDRG
\item 
\#define \hyperlink{pwm_8c_a93ed9e260ef93b97411fae336458aa99}{DIR\_\-MOTOR\_\-DDR\_\-L}~DDRG
\item 
\#define \hyperlink{pwm_8c_a4299b61044ce13718301f43935dbf078}{PWM\_\-MOTOR\_\-DDR\_\-R}~DDRB
\item 
\#define \hyperlink{pwm_8c_a4ff2faf0e2237bb95dc0385274d7eae7}{PWM\_\-MOTOR\_\-DDR\_\-L}~DDRG
\item 
\#define \hyperlink{pwm_8c_acaf62cfaf265db1b2ec6137f96ba1511}{DIR\_\-MOTOR\_\-PIN\_\-R}~PG3
\item 
\#define \hyperlink{pwm_8c_a16f884e70d0edb94a05736ec48995e29}{DIR\_\-MOTOR\_\-PIN\_\-L}~PG4
\item 
\#define \hyperlink{pwm_8c_a59a801fb905483b597637525a99cfcb9}{PWM\_\-MOTOR\_\-PIN\_\-R}~PB7
\item 
\#define \hyperlink{pwm_8c_aeecb87d199083fb93b7f598d58f7e54f}{PWM\_\-MOTOR\_\-PIN\_\-L}~PG5
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__nxbot__pwm_ga89212b075245454426b93c0f0a98900b}{pwm\_\-init} (unsigned char freq)
\begin{DoxyCompactList}\small\item\em Hardware initialization of the pwm module. \item\end{DoxyCompactList}\item 
void \hyperlink{group__nxbot__pwm_ga3ad4a487f5e13d60ca4afd576938a44b}{pwm\_\-setFreq} (unsigned char freq)
\begin{DoxyCompactList}\small\item\em Sets the frequency of the PWM signal. \item\end{DoxyCompactList}\item 
unsigned char \hyperlink{group__nxbot__pwm_ga75b4d66479bc6b0a563251c8f18846dd}{pwm\_\-getFreq} ()
\begin{DoxyCompactList}\small\item\em Gets the preconfigured frequency of the PWM signal. \item\end{DoxyCompactList}\item 
void \hyperlink{group__nxbot__pwm_ga218725a2b447740d97be3970ab29c7e5}{pwm\_\-writeRight} (signed char right)
\begin{DoxyCompactList}\small\item\em Write desired PWM value for right motor. \item\end{DoxyCompactList}\item 
void \hyperlink{group__nxbot__pwm_gaee380cd1b8aa28f7fdf34c634265bd68}{pwm\_\-writeLeft} (signed char left)
\begin{DoxyCompactList}\small\item\em Write desired PWM value for left motor. \item\end{DoxyCompactList}\item 
void \hyperlink{group__nxbot__pwm_ga5ed6b6cdaae3da51bab8ad7cc311a255}{pwm\_\-write} (signed char left, signed char right)
\begin{DoxyCompactList}\small\item\em Write desired PWM value for both left and right motors. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Define Documentation}
\hypertarget{pwm_8c_a93ed9e260ef93b97411fae336458aa99}{
\index{pwm.c@{pwm.c}!DIR\_\-MOTOR\_\-DDR\_\-L@{DIR\_\-MOTOR\_\-DDR\_\-L}}
\index{DIR\_\-MOTOR\_\-DDR\_\-L@{DIR\_\-MOTOR\_\-DDR\_\-L}!pwm.c@{pwm.c}}
\subsubsection[{DIR\_\-MOTOR\_\-DDR\_\-L}]{\setlength{\rightskip}{0pt plus 5cm}\#define DIR\_\-MOTOR\_\-DDR\_\-L~DDRG}}
\label{pwm_8c_a93ed9e260ef93b97411fae336458aa99}
\hypertarget{pwm_8c_a1ade39389d1a5235ed4d0f0f882356d6}{
\index{pwm.c@{pwm.c}!DIR\_\-MOTOR\_\-DDR\_\-R@{DIR\_\-MOTOR\_\-DDR\_\-R}}
\index{DIR\_\-MOTOR\_\-DDR\_\-R@{DIR\_\-MOTOR\_\-DDR\_\-R}!pwm.c@{pwm.c}}
\subsubsection[{DIR\_\-MOTOR\_\-DDR\_\-R}]{\setlength{\rightskip}{0pt plus 5cm}\#define DIR\_\-MOTOR\_\-DDR\_\-R~DDRG}}
\label{pwm_8c_a1ade39389d1a5235ed4d0f0f882356d6}
\hypertarget{pwm_8c_a16f884e70d0edb94a05736ec48995e29}{
\index{pwm.c@{pwm.c}!DIR\_\-MOTOR\_\-PIN\_\-L@{DIR\_\-MOTOR\_\-PIN\_\-L}}
\index{DIR\_\-MOTOR\_\-PIN\_\-L@{DIR\_\-MOTOR\_\-PIN\_\-L}!pwm.c@{pwm.c}}
\subsubsection[{DIR\_\-MOTOR\_\-PIN\_\-L}]{\setlength{\rightskip}{0pt plus 5cm}\#define DIR\_\-MOTOR\_\-PIN\_\-L~PG4}}
\label{pwm_8c_a16f884e70d0edb94a05736ec48995e29}
\hypertarget{pwm_8c_acaf62cfaf265db1b2ec6137f96ba1511}{
\index{pwm.c@{pwm.c}!DIR\_\-MOTOR\_\-PIN\_\-R@{DIR\_\-MOTOR\_\-PIN\_\-R}}
\index{DIR\_\-MOTOR\_\-PIN\_\-R@{DIR\_\-MOTOR\_\-PIN\_\-R}!pwm.c@{pwm.c}}
\subsubsection[{DIR\_\-MOTOR\_\-PIN\_\-R}]{\setlength{\rightskip}{0pt plus 5cm}\#define DIR\_\-MOTOR\_\-PIN\_\-R~PG3}}
\label{pwm_8c_acaf62cfaf265db1b2ec6137f96ba1511}
\hypertarget{pwm_8c_ae3f22938cba24c4b865d84a741cc21f5}{
\index{pwm.c@{pwm.c}!DIR\_\-MOTOR\_\-PORT\_\-L@{DIR\_\-MOTOR\_\-PORT\_\-L}}
\index{DIR\_\-MOTOR\_\-PORT\_\-L@{DIR\_\-MOTOR\_\-PORT\_\-L}!pwm.c@{pwm.c}}
\subsubsection[{DIR\_\-MOTOR\_\-PORT\_\-L}]{\setlength{\rightskip}{0pt plus 5cm}\#define DIR\_\-MOTOR\_\-PORT\_\-L~PORTG}}
\label{pwm_8c_ae3f22938cba24c4b865d84a741cc21f5}
\hypertarget{pwm_8c_a28e851ad9a01cfdb26991ccbabd1f06c}{
\index{pwm.c@{pwm.c}!DIR\_\-MOTOR\_\-PORT\_\-R@{DIR\_\-MOTOR\_\-PORT\_\-R}}
\index{DIR\_\-MOTOR\_\-PORT\_\-R@{DIR\_\-MOTOR\_\-PORT\_\-R}!pwm.c@{pwm.c}}
\subsubsection[{DIR\_\-MOTOR\_\-PORT\_\-R}]{\setlength{\rightskip}{0pt plus 5cm}\#define DIR\_\-MOTOR\_\-PORT\_\-R~PORTG}}
\label{pwm_8c_a28e851ad9a01cfdb26991ccbabd1f06c}
\hypertarget{pwm_8c_a173370575e519e4b39a40dcbed25b05c}{
\index{pwm.c@{pwm.c}!MASK\_\-FREQ@{MASK\_\-FREQ}}
\index{MASK\_\-FREQ@{MASK\_\-FREQ}!pwm.c@{pwm.c}}
\subsubsection[{MASK\_\-FREQ}]{\setlength{\rightskip}{0pt plus 5cm}\#define MASK\_\-FREQ~0xF8}}
\label{pwm_8c_a173370575e519e4b39a40dcbed25b05c}
\hypertarget{pwm_8c_a1380779eb88f44d3b04f56f34844cd49}{
\index{pwm.c@{pwm.c}!PRESCALER\_\-1@{PRESCALER\_\-1}}
\index{PRESCALER\_\-1@{PRESCALER\_\-1}!pwm.c@{pwm.c}}
\subsubsection[{PRESCALER\_\-1}]{\setlength{\rightskip}{0pt plus 5cm}\#define PRESCALER\_\-1~PWM\_\-FREQUENCY\_\-15K}}
\label{pwm_8c_a1380779eb88f44d3b04f56f34844cd49}
\hypertarget{pwm_8c_adf7f1e9c11964c6871486a89e6cce487}{
\index{pwm.c@{pwm.c}!PRESCALER\_\-1024@{PRESCALER\_\-1024}}
\index{PRESCALER\_\-1024@{PRESCALER\_\-1024}!pwm.c@{pwm.c}}
\subsubsection[{PRESCALER\_\-1024}]{\setlength{\rightskip}{0pt plus 5cm}\#define PRESCALER\_\-1024~PWM\_\-FREQUENCY\_\-16M}}
\label{pwm_8c_adf7f1e9c11964c6871486a89e6cce487}
\hypertarget{pwm_8c_a052c8c73dbda6c25f480ace56519a596}{
\index{pwm.c@{pwm.c}!PRESCALER\_\-256@{PRESCALER\_\-256}}
\index{PRESCALER\_\-256@{PRESCALER\_\-256}!pwm.c@{pwm.c}}
\subsubsection[{PRESCALER\_\-256}]{\setlength{\rightskip}{0pt plus 5cm}\#define PRESCALER\_\-256~PWM\_\-FREQUENCY\_\-2M}}
\label{pwm_8c_a052c8c73dbda6c25f480ace56519a596}
\hypertarget{pwm_8c_a8ef1c1674bc0e2e5a50b5ef05333acbb}{
\index{pwm.c@{pwm.c}!PRESCALER\_\-64@{PRESCALER\_\-64}}
\index{PRESCALER\_\-64@{PRESCALER\_\-64}!pwm.c@{pwm.c}}
\subsubsection[{PRESCALER\_\-64}]{\setlength{\rightskip}{0pt plus 5cm}\#define PRESCALER\_\-64~PWM\_\-FREQUENCY\_\-250K}}
\label{pwm_8c_a8ef1c1674bc0e2e5a50b5ef05333acbb}
\hypertarget{pwm_8c_aea484618f5434fb66fe764a38f440f1b}{
\index{pwm.c@{pwm.c}!PRESCALER\_\-8@{PRESCALER\_\-8}}
\index{PRESCALER\_\-8@{PRESCALER\_\-8}!pwm.c@{pwm.c}}
\subsubsection[{PRESCALER\_\-8}]{\setlength{\rightskip}{0pt plus 5cm}\#define PRESCALER\_\-8~PWM\_\-FREQUENCY\_\-62K}}
\label{pwm_8c_aea484618f5434fb66fe764a38f440f1b}
\hypertarget{pwm_8c_a522f80b91bede3a41970a0c8bc2af286}{
\index{pwm.c@{pwm.c}!PWM\_\-L@{PWM\_\-L}}
\index{PWM\_\-L@{PWM\_\-L}!pwm.c@{pwm.c}}
\subsubsection[{PWM\_\-L}]{\setlength{\rightskip}{0pt plus 5cm}\#define PWM\_\-L~OCR0B}}
\label{pwm_8c_a522f80b91bede3a41970a0c8bc2af286}
\hypertarget{pwm_8c_a4ff2faf0e2237bb95dc0385274d7eae7}{
\index{pwm.c@{pwm.c}!PWM\_\-MOTOR\_\-DDR\_\-L@{PWM\_\-MOTOR\_\-DDR\_\-L}}
\index{PWM\_\-MOTOR\_\-DDR\_\-L@{PWM\_\-MOTOR\_\-DDR\_\-L}!pwm.c@{pwm.c}}
\subsubsection[{PWM\_\-MOTOR\_\-DDR\_\-L}]{\setlength{\rightskip}{0pt plus 5cm}\#define PWM\_\-MOTOR\_\-DDR\_\-L~DDRG}}
\label{pwm_8c_a4ff2faf0e2237bb95dc0385274d7eae7}
\hypertarget{pwm_8c_a4299b61044ce13718301f43935dbf078}{
\index{pwm.c@{pwm.c}!PWM\_\-MOTOR\_\-DDR\_\-R@{PWM\_\-MOTOR\_\-DDR\_\-R}}
\index{PWM\_\-MOTOR\_\-DDR\_\-R@{PWM\_\-MOTOR\_\-DDR\_\-R}!pwm.c@{pwm.c}}
\subsubsection[{PWM\_\-MOTOR\_\-DDR\_\-R}]{\setlength{\rightskip}{0pt plus 5cm}\#define PWM\_\-MOTOR\_\-DDR\_\-R~DDRB}}
\label{pwm_8c_a4299b61044ce13718301f43935dbf078}
\hypertarget{pwm_8c_aeecb87d199083fb93b7f598d58f7e54f}{
\index{pwm.c@{pwm.c}!PWM\_\-MOTOR\_\-PIN\_\-L@{PWM\_\-MOTOR\_\-PIN\_\-L}}
\index{PWM\_\-MOTOR\_\-PIN\_\-L@{PWM\_\-MOTOR\_\-PIN\_\-L}!pwm.c@{pwm.c}}
\subsubsection[{PWM\_\-MOTOR\_\-PIN\_\-L}]{\setlength{\rightskip}{0pt plus 5cm}\#define PWM\_\-MOTOR\_\-PIN\_\-L~PG5}}
\label{pwm_8c_aeecb87d199083fb93b7f598d58f7e54f}
\hypertarget{pwm_8c_a59a801fb905483b597637525a99cfcb9}{
\index{pwm.c@{pwm.c}!PWM\_\-MOTOR\_\-PIN\_\-R@{PWM\_\-MOTOR\_\-PIN\_\-R}}
\index{PWM\_\-MOTOR\_\-PIN\_\-R@{PWM\_\-MOTOR\_\-PIN\_\-R}!pwm.c@{pwm.c}}
\subsubsection[{PWM\_\-MOTOR\_\-PIN\_\-R}]{\setlength{\rightskip}{0pt plus 5cm}\#define PWM\_\-MOTOR\_\-PIN\_\-R~PB7}}
\label{pwm_8c_a59a801fb905483b597637525a99cfcb9}
\hypertarget{pwm_8c_a3fca9ad5cde3e6b6b50ad428aa007b2a}{
\index{pwm.c@{pwm.c}!PWM\_\-R@{PWM\_\-R}}
\index{PWM\_\-R@{PWM\_\-R}!pwm.c@{pwm.c}}
\subsubsection[{PWM\_\-R}]{\setlength{\rightskip}{0pt plus 5cm}\#define PWM\_\-R~OCR0A}}
\label{pwm_8c_a3fca9ad5cde3e6b6b50ad428aa007b2a}
